<h1>Listing products</h1>

<table>
  <tr>
    <th>Name</th>
    <th>Code</th>
    <th>PKWiU</th>
    <th>Unit</th>
    <th>Net price</th>
    <th>Vat rate</th>
  </tr>
  
  <tr align="center">
  <% form_tag :action => 'filter' do %>
    <td><%= text_field("filter", "name", :size => 30) %></td>
    <td><%= text_field("filter", "code", :size => 10) %></td>
    <td><%= text_field("filter", "pkwiu", :size => 10) %></td>
    <td><%= text_field("filter", "unit", :size => 5) %></td>
    <td><%= text_field("filter", "net_price", :size => 12) %></td>
    <td><%= text_field("filter", "vat_rate", :size => 5) %></td>
    <td><input type="submit" value="Filter" /></td>
  <% end %>
  </tr>

<% @products.each do |product| %>
  <tr>
    <td><%=h product.name %></td>
    <td><%=h product.code %></td>
    <td><%=h product.pkwiu %></td>
    <td><%=h product.unit %></td>
    <td><%=h product.net_price %></td>
    <td><%=h product.vat_rate %></td>
    <td/>
    <td><%= link_to 'Show', product %></td>
    <td><%= link_to 'Edit', edit_product_path(product) %></td>
    <td><%= link_to 'Delete', product, :confirm => 'Are you sure?', :method => :delete %></td>
  </tr>
<% end %>
</table>

<div class="pagination">
  <%= will_paginate @products, :params => {'query' => flash[:query], :param_table => flash[:param_table]} %>
</div>

<%= link_to 'New product', new_product_path %>